-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Webpack #1971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cb8c67a
to
8ac5547
Compare
Lodash has no default export. Should thus import through "import * as name 'dependency'".
@@ -1,5 +1,5 @@ | |||
'use strict'; | |||
import _ from 'lodash'; | |||
import * as _ from 'lodash'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this change anything? Shouldn't the same methods be available on both the default export and the named exports?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well yes, I believe if there is a default export, there should be no difference. Lodash does however not appear to have one. Visual studio code warned me about that particular fact and I think it was among the typings error spam.
As far as I've read elsewhere you need to import it like above when there is no default export. Or use a require.
Before the above fix I also get the following error in the browser when changing route. I.e. going from home to admin or settings:
angular.js:13708 TypeError: Cannot read property 'noop' of undefined
at router.decorator.ts:25
at Scope.$broadcast (angular.js:17767)
at Object.transitionTo (angular-ui-router.js:3272)
at Object.go (angular-ui-router.js:3107)
at angular-ui-router.js:4143
at angular.js:19374
at completeOutstandingRequest (angular.js:5955)
at angular.js:6234
After the change the error does not appear again. Failing checks have me nervous but tests seem to pass with "gulp test" locally for me at least. Though there was a too long timeout (5000+ ms) on the server 1 out of 2 times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I believe that's where Babel & TypeScript differ with modules. I believe this is the same reason why I had to use require
s for angular modules when using TS. It works with Babel.
Extending interface ErrorConstructor with another variable.
Hmmmm, here's the new error that suddenly popped up
|
f007ce5
to
8db71f1
Compare
Planning on merging in one commit with fixes for most of the TypeScript type errors tomorrow (monday), just missing a few for some tests and one jquery + protractor typing that cannot be mixed. Think we essentially need to separate the regular typings from the test typings to fix the latter error. Just need to observe that the changes for babel look okay as well. Biggest changes are probably interfaces for the admin and user services.An annoying addition is however that you have to tell typescript which type is being returned for the functions that are either asynchronous or synchronous as it cannot tell them apart from how many parameters you send in, nor do they apparently plan on supporting that in the future. Could alternatively also refactor the methods to be named differently depending on if they're asynchronous or synchronous. Would then organically work as expected. @Awk34 Do you figure that there's much more left to get the build to work other than fixing a few things in the gulp pipeline that starts webpack? Also a bit confused about what actually starts webpack when running gulp serve. From the log I'm thinking it's in start:client or start:server but can't find the starting point. Something similar planned for gulp build or using the Either way, thinking of trying to get some basic build up and running tomorrow, any pointers or instructions would thus be highly welcomed. |
Yeah, I definitely want to split those into two methods ( I think we're close to being able to merge it into canary. When in development, webpack is actually being run from inside the express server, here. This is to achieve the right pairing of the full-stack nature with live-reload. What specific are you looking for in terms of pointers/instructions? |
Sounds good.
Ok, finally makes sense to me then :). Should be fine to remove gulp task Slightly related to that, do you have any strong feelings or insights concerning browser-sync vs live-reload? I.e. #1955, as stated there I think there are some more compelling features with browser-sync, I am not confident that it's strictly better or that browser-sync itself does not lack some features that live-reload has. Either way I would consider just getting webpack and likely most of Angular 2 working higher priority.
Think I'm mostly looking for a small summary on what's left to make the build work, including any thoughts you have on the overall flow. So that I don't unnecessarily go down a completely different road. Right now I'm thinking it's only about removing deprecated gulp tasks in the gulp build pipeline and then possibly doing some adjustments to the webpack build configuration. Just a bit unsure of how much webpack is doing and how much, if anything is left to get a reasonable webpack build going. |
We could leave it. It's not doing any harm. IDC. I have no real opinion on browser-sync vs live-reload.
I think the flow is pretty good right now. Removing any more code that we don't need anymore is fine by me. I'm going to be mainly doing cleanup now. One thing is we still need to figure out why the E2E tests have started failing. They run fine locally still, but not on CI. I don't get it.
If you're unsure, don't commit directly to this branch. You might also wait until this is merged into canary, and then make another PR. I plan on merging this branch into canary this week. |
@Koslun one thing to mention: I'd like to keep as many of the type annotations language-agnostic as I can (TypeScript / Flow). The way the main generator works right now, is the files are run through EJS, and then Babel. I have it default to always use the So that also means that if there's a typing that would work for both TS & Flow, there's no need to add EJS around it, since Babel would be able to interpret it. |
One thing that just occurred to me: I have all the front-end dependencies in the |
Yeah the only harm it can do is be slightly confusing to anyone who peeks at it, so just leaving it for now then.
Probably going to explore that once Angular 2 and its extra features are in browser-sync.
Yeah I scoped all of the types to
Sounds good. Will experiment a little locally and either get a new PR up once this is merged or try to contribute if you setup another PR for it.
Yeah, that is interesting. I do however wonder how exactly this is solved with Angular Universal. Have to get Angular 2 up first though. |
@Koslun I've backed out that latest commit for now (I put it on the ts-stuff branch for safe keeping) |
…or-angular-fullstack into webpack # Conflicts: # templates/app/client/components/auth(auth)/router.decorator.js
Grunt